import { request, config } from 'utils'

const { api } = config
const { categoryCreate,categoryCreateList,addByCategory,deleteByCategory,uploadCategory,findErrorCode,findByCategory} = api

export async function findCode (params) {
  return request({
    url: findErrorCode,
    method: 'get',
    data: params,
    withoutToken: true
  })
}
export async function query (params) {
  return request({
    url: `${findByCategory}/${params}`,
    method: 'post',
    data: params,
    withoutToken: true
  })
}
export async function uploadCa (params,deleteId) {
  return request({
    url: `${uploadCategory}?category=${deleteId}`,
    method: 'post',
    data: params,
    withoutToken: true,
    headers: { 'content-type': 'multipart/form-data' }
  })
}
export async function save (params) {
    return request({
      url: addByCategory,
      method: 'post',
      data: params,
      withoutToken: true
    })
  }
  export async function deleteId (params) {
    return request({
      url: `${deleteByCategory}/${params.id}`,
      method: 'post',
      data: params,
      withoutToken: true
    })
  }
export async function add (params) {
  return request({
    url: categoryCreate,
    method: 'post',
    data: params,
    withoutToken: true
  })
}
export async function getList (params) {
    return request({
      url: categoryCreateList,
      method: 'get',
      data: params,
      withoutToken: true
    })
  }